<?php if (is_page(array(7379,7381,7383))) { ?>
    <?php include 'page-template-product-resources.php'; ?>
<?php } elseif ((is_page(14299)) || ($post->post_parent == '14299')) { ?>
    <?php include 'esp-page-template-home.php'; ?>
<?php } else { ?>

<?php get_header() ?>

	<div id="container">
    
    	<?php include('breadcrumbs.php'); ?>
    
    	<?php get_sidebar() ?>
    
		<div id="content">

		<?php the_post() ?>
        
        <?php if ($post->post_parent=="6983") { ?>
			<?php include 'page-template-state-pages.php'; ?>
		<?php } elseif (is_page("7312")) { ?>
        	<?php include 'page-template-document-center.php'; ?>
        <?php } else { ?>
        
        <!-- INCLUDE FINANCE MENU IF PAGE IS IN FINANCE SECTION - APR 2012 MATT B -->
        
        	<?php if(is_page(array(3957,3983,4062,3986,4064)) )  include 'finance-menu-small.php' ; ?>
			<?php if(is_page(array(4027,4041,4045,4052,3959,4058,3977,4060)) ) include 'finance-menu.php'  ; ?>
        
        <!-- END FINANCE MENU SECTION -->

			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
				<h2 class="entry-title"><?php the_title() ?></h2>
                <?php include ('socialbuttons.php'); ?>
				<div class="entry-content">
                
                	<!-- INCLUDE TARGET MARKET CONTENT -->
                    <?php if(is_page(214) )  include 'page-residentialcontent.php' ; ?>
                    <?php if(is_page(216) )  include 'page-commercialcontent.php' ; ?>
                    <?php if(is_page(221) )  include 'page-dealercontent.php' ; ?>
                    
                    <?php // if(is_page(5465) )  include 'pricelist-resppkits.php' ; ?>
                    <?php if(is_page(5543) )  include 'page-engineeringcontent.php' ; ?>
                    <?php if(is_page(5545) )  include 'page-educationcontent.php' ; ?>
                    <?php if(is_page(98) )  include 'page-nonpressuretankscontent.php' ; ?>
                    
                    <!-- INCLUDE FEATURED IMAGES -->
                    <?php if(is_page(array(5683,5686)) ) { ?>
						<div class="thumbnailblock" style="width: 300px; float: right; margin: 0px; margin-left: 20px; margin-bottom: 10px; border: #cccccc 3px solid;">
							<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
							<img src="<?php echo $feat_image; ?>" alt="<?php the_title(); ?>" style="width:300px;" />
						</div>
					<?php } ?>
                
					<?php the_content() ?>
			
			<?php // Include contact form on training contact page
				if (is_page(1165)) {
					include 'page-include-contact-sunmaxx.php';
				} ?>
                    
                    <?php // Include The Page Template For The Product Document Category Page
						if (is_page('10298')) { include 'page-template-document-category.php'; }
					?>
                    
                    <?php // Include The Category Header / Banner If Desired
						if (get_post_meta($post->ID, 'storeCategoryHeader', true) == 'Yes') { include 'page-include-store-cat-header.php'; }
					?>
                    
                    <?php if (get_post_meta($post->ID, 'storeCategorySlug', true)) { ?>
                    	<?php $storecategory = get_post_meta($post->ID, 'storeCategorySlug', true); ?>
                    	<?php echo wpsc_display_products_page(array( 'category_url_name'=>''.$storecategory.'' )) ; ?>
                    <?php } ?>
                    
                    <!-- SPECIFIC PAGE INCLUDES - BELOW CONTENT -->
					<?php // if(is_page(203) )  include 'includes-heatexchangers.php' ; ?>
                    <?php // if(is_page(207) )  include 'includes-glycol.php' ; ?>
                    <?php if(is_page(5527) )  include 'includes-dealermarketing.php' ; ?>
                    <?php if(is_page(6) )  include 'page-pvsystemscontent.php' ; ?>
                    
                    <!-- INCLUDE IMAGE GALLERY CODE FOR GALLERY PAGE -->
                    <?php if(is_page(265) )  include 'image-gallery.php' ; ?>
                    
                    <!-- INCLUDE FOR CONTENT SECTION FOR PV SYSTEM PAGES -->
                    <?php if(is_page(5683) )  include 'page-residentialpvcontent.php' ; ?>
                    <?php if(is_page(5686) )  include 'page-commercialpvcontent.php' ; ?>
            
            		<!-- INCLUDE DOCUMENT CENTER BUTTON ON AE PAGES -->
                    <?php if(is_page(array(3849,4260,4262,4264,4266,4268,4270,4272)) )  include 'document-center-button.php' ; ?>
                    
                    <!-- INCLUDE PRODUCT IMAGE GALLERY IF INCLUDED -->
                    <?php if ( get_post_meta($post->ID, 'imagestag', true) ) { ?>
                    	<?php include ('tags-gallery.php'); ?>
                    <?php } ?>
                    
                    <?php // Include Custom Page Content If Tagged
						if (get_post_meta($post->ID, 'pageCustomContent', true)) {
							$customcontent = get_post_meta($post->ID, 'pageCustomContent', true);
							include ($customcontent) ;
					} ?>
                    
                    <?php // Include Chart For Page If Available
						if(get_post_meta($post->ID, 'pageChartCode', true)) {
							$charttitle = get_post_meta($post->ID, 'pageChartTitle', true);
							$chartsubtitle = get_post_meta($post->ID, 'pageChartSubTitle', true);
							echo "<h3>".$charttitle."</h3>";
							echo "<h2>".$chartsubtitle."</h2>";
							echo do_shortcode(get_post_meta($post->ID, 'pageChartCode', true)); 
					} ?> 
                    
                    <?php // Include Image Galleries If Called For
						if(get_post_meta($post->ID, 'pageGalleryOne', true) || get_post_meta($post->ID, 'pageGalleryTag', true) || get_post_meta($post->ID, 'imagestag', true)) { ?>
                    		<?php include 'page-include-galleries.php' ; ?>
                    <?php } ?>

			<?php // INCLUDE RELATED DOCUMENTS BY TAG
				if (get_field('show_documents') == 'Yes') {
					include 'page-include-document-tag-list.php' ;
				}
			?>
                    
                    <?php // Include Sub-Pages For Pages To Show Sub Pages 
						if(get_post_meta($post->ID, 'pageSubPages', true) != Null) { ?>
						<?php include 'page-include-subpages.php' ; ?>	
                    <?php } ?>

			<?php // Include The Embedded Document If Called For
				if(get_field("embedpdfurl")) {
				$embedfile = get_field("embedpdfurl");
				echo do_shortcode("[gview file='{$embedfile}']");
			} ?>
                    
                    <?php // Include The Bottom Of Page CTA Call-In
						if(! is_page(509)) include 'page-include-bottom-cta.php' ; ?>
                        
                    <?php // Include Pricelist Styles If Category Pricelist Is Called For
						if (get_post_meta($post->ID, 'pagePriceCategory', true)) {
							include 'style-pricelist.php';
						} ?>

<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'sandbox' ) . '&after=</div>') ?>

<?php edit_post_link( __( 'Edit', 'sandbox' ), '<span class="edit-link">', '</span>' ) ?>

				</div>
			</div><!-- .post -->
            
            <?php } ?>

		</div><!-- #content -->
	</div><!-- #container -->

<?php get_footer() ?>

<?php } ?>